<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>

    <style>
        
    </style>
</head>

<script>
    

    new Promise((resolve, reject)=>{
        resolve('改变promise状态为成功')
    })
    .then(
        value => console.log(value) // 改变promise状态为成功
    )
    .catch(
        reason => console.log(reason)
    )



    new Promise((resolve, reject)=>{
        reject('改变promise状态为失败')
    })
    .then(
        value => console.log(value)
    )
    .catch(
        reason => console.log(reason)   // 改变promise状态为失败
    )



    new Promise((resolve, reject)=>{
        throw '将成为失败原因'
    })
    .then(
        value => console.log(value)
    )
    .catch(
        reason => console.log(reason)   // 将成为失败原因
    )



    new Promise((resolve, reject)=>{
        throw new Error('将成为失败原因')
    })
    .then(
        value => console.log(value)
    )
    .catch(
        reason => console.log(reason.message)   // 将成为失败原因
    )



</script>

<body>
    
</body>

</html>